home *** CD-ROM | disk | FTP | other *** search
- /* Optimized with RexxOpt 1.6 */
- maxads=300;configname='S:DelAds.list';busy on;signal on syntax;options results;options failat 21;lf='a'x;flag=0;call initlocale;viewer='SYS:utilities/MultiView';now=date('C');nads=0;totremoved=0;addextra=0;datediff=14;if open('configfile',configname) then;do;thisline=readln('configfile');do until eof('configfile');nads=nads+1;if nads>maxads then;leave;parse var thisline removed.nads date.nads adname.nads;parse var adname.nads ' ' adname.nads;say totremoved removed.nads date.nads adname.nads;totremoved=totremoved+removed.nads;thisline=readln('configfile');end;close('configfile');end;compare='';do i=1 to nads;compare=compare i':'adname.i;end;query updateflags;follow=bittst(d2c(result),1);query font 8;fonttag='rt_font='result;remember;busy on;modify deleteflags 8;query screenname;if result=0 then;screenname=address();else;screenname=result;status 3;window=result;status 9 window;entries=result;if entries=0 then;call quitit msg.1;eztags='rt_reqpos=reqpos_centerscr rt_pubscrname='screenname 'rtez_flags=ezreqf_centertext' fonttag;if ~show('l','rexxreqtools.library') then;call addlib('rexxreqtools.library',0,-30,0);call rtezrequest(msg.2,msg.3,,eztags);if rtresult=0 then;call quitit msg.4;automatic=(rtresult=2);checkabort;status 13 window;drawer=result;do entries;getnextselected;filename=result;if follow then;scrolltoshow '"'filename'"';call insstr(filename,msg.5);toptext msgstring;ext=upper(right(filename,4));arcfile=ext='.LHA'|ext='.LZH'|ext='.RUN';fileinfo '"'filename'" /';parse var result . '/' . '/' . '/' filetype '/';if filetype>0|~arcfile then;call skipask msg.6;else;do;address command 'LhA >T:Delads.temp vq -N -Qw -Qo "'drawer||filename'"';if rc>0 then;call skipask msg.8;else;do;call open('tempfile','T:Delads.temp','r');nfiles=0;do until eof('tempfile');nfiles=nfiles+1;name.nfiles=readln('tempfile');end;nfiles=nfiles-1;call close('tempfile');delthese='';delcount=0;call open('actionfile','T:actionfile','w');do i=nfiles to 1 by-1;cuthere=pos(':'name.i' ',compare' ');delthisentry=0;select;when upper(name.i)=='FILE_ID.DIZ' then;nop;when right(upper(name.i),10)=='.DISPLAYME' then;call markfordel;when cuthere>0 then;call markfordel;when automatic then;delthisentry=1;otherwise;do;call insstr(name.i,msg.9);call rtezrequest(msgstring,msg.10,,eztags);select;when rtresult=0 then;call TELE;when rtresult=1 then;do;delthisentry=1;addextra=addextra+1;end;when rtresult=3 then;call quitit msg.4;when rtresult=2 then;do;toptext msg.11;address command 'LhA e -q -x2 -a -C0 -Qo "'patchname(drawer||filename)'" T: "'patchname(name.i)'"';if rc>0 then;do;call skipask msg.12;delcount=0;leave;end;temp=reverse(name.i);parse var temp thisfile '/';thisfile='"T:'reverse(thisfile)'"';address command viewer 'PUBSCREEN' screenname thisfile;if rc>0 then;do;beep;busy on;call insstr(viewer,msg.13);call rtezrequest(msgstring,,,eztags);end;delete thisfile;busy on;call insstr(name.i,msg.14);call rtezrequest(msgstring,msg.15,,eztags);delthisentry=result;end;otherwise delthisentry=0;end;if delthisentry then;do;if nads>=maxads then;do;beep;call rtezrequest('Too many adds',maxads,,);leave;end;nads=nads+1;adname.nads=name.i;date.nads=now;removed.nads=1;compare=compare nads':'name.i;call markfordel;end;end;end;end;busy on;call close('actionfile');if delcount>0 then;do;toptext msg.16 delcount'x'delthese;flag=1;address command 'LhA d -q -Qp -Qo "'patchname(drawer||filename)'" @T:actionfile';if rc>0 then;call skipask msg.17;delete 'T:actionfile';busy on;end;end;end;selectfile filename 0 1;checkabort;if result then;call stopit msg.4;end;call stopit;syntax:;call rtezrequest(name.i,date.i,,);call quitit "Syntax Error" rc"," errortext(rc) "in line" sigl".";exit;initlocale:;msg.1="Nothing selected!";msg.2="How do you want to delete the\n.Displayme's and BBS ads?";msg.3="_Interactive|_Automatic|A_bort";msg.4="Aborted...";msg.5="Processing '%s'...";msg.6="Sorry, I can only process LhA archives!";msg.7="ERROR";msg.8="Error while listing archive.";msg.9="Do you want to delete the file\n%s\nfrom the archive?";msg.10="_Yes|_View|_Exit|_No|_Go";msg.11="Extracting file...";msg.12="Error while extracting.";msg.13="Sorry, %s cannot\nview this file.";msg.14="Well, do you want to delete the file\n%s\nfrom the archive?";msg.15="_Yes|_No";msg.16="Deleting:";msg.17="Error while deleting from archive.";msg.18="Do you wish to skip this file?";msg.19="_Skip|S_top";msg.20="Syntax Error %s, %s in line %s.";msg.21="Saving config...";msgno=21;ok=show(l,'locale.library');if ~ok then;ok=addlib('locale.library',0,-30);if ok then;do;catalog=opencatalog('Delads.catalog','',0);if catalog~=0 then;do i=1 to msgno;msg.i=getcatalogstr(catalog,i,msg.i);end;call closecatalog(catalog);end;do i=1 to msgno;if pos('\n',msg.i)>0 then;do;parse var msg.i fore '\n' aft;msg.i=fore||'a'x||aft;i=i-1;end;end;return;patchname:;parse arg patched;pos=1;do forever;here=verify(substr(patched,pos),'*#?|%()[]~','m');if here=0 then;leave;pos=pos+here+1;patched=insert("'",patched,pos-3);end;do forever;here=verify(substr(patched,pos),"@'",'m');if here=0 then;leave;pos=pos+here+1;patched=insert("*",patched,pos-3);end;return patched;skipask:;parse arg reason;beep;busy on;call rtezrequest(reason||lf||msg.18,msg.19,,eztags);if ~rtresult then;call stopit;return;insstr:;parse arg replace,msgstring;if pos('%s',msgstring)>0 then;do;parse var msgstring fore '%s' aft;msgstring=fore||replace||aft;end;return;markfordel:;totremoved=totremoved+1;delcount=delcount+1;delthese=delthese "'"name.i"'";call writeln('actionfile','"'patchname(name.i)'"');if cuthere>0 then;do;cutagain=lastpos(' ',compare,cuthere-1)+1;fileno=substr(compare,cutagain,cuthere-cutagain);removed.fileno=removed.fileno+1;date.fileno=now;end;return;stopit:;parse arg topline;if flag then;call updateconfig;call quitit topline;TELE:;call close('actionfile');if delcount>0 then;do;flag=1;toptext msg.16 delcount'x'delthese;address command 'LhA d -q -Qp -Qo "'patchname(drawer||filename)'" @T:actionfile';delete 'T:actionfile';selectfile filename 0 1;end;checkabort;if result then;call quitit msg.4;call stopit;updateconfig:;busyon;toptext msg.21;call open('configfile',configname,'w');do i=1 to nads;if date.i+ datediff>=now then;call writeln('configfile',removed.i date.i adname.i);end;call close('configfile');busyoff;return;quitit:;parse arg topline;if flag then;rescan;if exists('T:Delads.temp') then;delete 'T:Delads.temp';if exists('T:actionfile') then;do;call close('actionfile');delete 'T:actionfile';end;if topline~=="" then;toptext topline;if pos(msg.7,upper(topline))>0 then;beep;restore;busy off;exit